<?php       session_start(); 
function edad($edad){
list($anio,$mes,$dia) = explode("-",$edad);
$anio_dif = date("Y") - $anio;
$mes_dif = date("m") - $mes;
$dia_dif = date("d") - $dia;
if ($dia_dif < 0 || $mes_dif < 0)
$anio_dif--;
return $anio_dif;
}
      if (isset($_SESSION['k_username'])) {

?>

<html>

<head>

<title>INTRANET GOTICA</title>

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

<link rel="shortcut icon" href="favicon.ico" />  

<? if($_SESSION['grupo']==5 ){ ?>
<link rel="stylesheet" href="css/stylecdm.css" type="text/css" />
<? }else{ ?>
<link rel="stylesheet" href="css/style1.css" type="text/css" />
<? } ?>



</head>

<body>

<?

if($_SESSION['grupo']==1 || $_SESSION['grupo']==3 ){

echo "<form method=\"post\" action=\"exportexcel.php\">";

echo "<input type=\"hidden\" name=\"num\" value=9 />";

echo "<input type=\"submit\" value=\"Para Courier\" />";

echo "</form>";}

?>

<div id="round"><div id="container">

 <div id="content" class="column span-14">

<? echo "<h1>Intranet Gotica</h1>";  



include('conexion.inc.php');

  $link = Conectarse();

mysql_select_db("gotica_sociosgotica",$link);
$mess = date("m")-1;
$anio = date("y")-1;
$messs=date("m");
/*$sqlsms = "UPDATE socio_tiposocio SET idestado=3 WHERE (idtiposocio=6 OR idtiposocio=9)  AND (month(FechaIngreso)=".$mess." OR month(FechaIngreso)=".$messs.")AND ((year(FechaIngreso)<".$anio.")) AND (idestado=1)";
$resultsms = mysql_query($sqlsms, $link);
$sqlsm = "SELECT * FROM socio_tiposocio WHERE  idestado=3 ";
$resultsm = mysql_query($sqlsm, $link);*/
echo "<h1>Renovaciones</h1>";
echo "<table  width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\" align=\"center\">";

/*while ($rowsm = mysql_fetch_array($resultsm))
{
echo "<tr>";
echo "<form method=\"post\" action=\"modulos/socios/renovacion.php\">";
echo "<td><input type=\"submit\" name=\"renovar\" value=\"Renovar\" /></td>";
echo "<input type=\"hidden\" name=\"idsocio\" value=\"".$rowsm['idsocio']."\">";
echo "<input type=\"hidden\" name=\"idtiposocio\" value=\"".$rowsm['idtiposocio']."\">";
$sqlsm1 = "SELECT * FROM socios WHERE  idsocio=".$rowsm['idsocio'];
$resultsm1 = mysql_query($sqlsm1, $link);
$rowsm1=mysql_fetch_array($resultsm1);

echo "<td>";
echo  $rowsm1['Nombres']." ".$rowsm1['ApPaterno']." ".$rowsm1['ApMaterno'];
echo "</td>";
echo "</form>";
echo "</tr>";
}

echo "</table>";*/

$ese=$_SESSION['k_username'];

$sql10 = "SELECT * FROM tareas WHERE idRealiza=\"$ese\"";

$result10 = mysql_query($sql10, $link);

echo "<h1>Tareas</h1>";
echo "<form method=\"post\" action=\"modulos/usuarios/vertarea.php\">";
echo "<table>";



while($row10= mysql_fetch_array($result10)){

if ($row10['Hecha']!=1){
echo "<tr><td>";

echo "<input type=\"hidden\" name=\"idtarea\" value=\"$row10[idtarea]\" /><input type=\"submit\" class=\"buttonmi\" name=\"ver\" value=\"Ver\" />";

echo "</td><td>";

echo "Tienes una tarea por ".$row10['idPide'];

echo "</td></tr>"; }

}

echo "</table>";

echo "</form>"; 

function operacion_fecha ($fecha,$dias) {  

list ($dia,$mes,$ano)=explode("-",$fecha);  

if (!checkdate($mes,$dia,$ano)){return false;}  

$dia=$dia+$dias;  

$fecha=date( "d-m-Y", mktime(0,0,0,$mes,$dia,$ano) );  

return $fecha;  

} 

if($_SESSION['grupo']==1 || $_SESSION['grupo']==3 || $_SESSION['grupo']==2 ){

echo "<h1>Cumpleaños</h1>";

for ($i=0;$i<7;$i++){



$dia= date("d", strtotime("+$i day"));

$mes= date("m", strtotime("+$i day"));

$anio=date("y", strtotime("+$i day"));

$fecha=$dia."-".$mes."-".$anio;



$sql = "SELECT * FROM socios WHERE MONTH(FechaNacimiento)=$mes AND DAY(FechaNacimiento)=$dia";

$result = mysql_query($sql, $link);

$fecha=$dia."-".$mes."-".$anio;

if (mysql_num_rows($result)>0){

echo "<table  width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\" align=\"center\">";

echo "<tr class=\"dataheader\" align=\"center\" ><td colspan=12>";

echo $fecha."</td></tr>";



$cont=0;

while ($row = mysql_fetch_array($result))

{



$fechass="20".date("y");

$sqll = "SELECT * FROM llamado WHERE idsocio=".$row['idsocio']." and YEAR(hoy)=$fechass";

$resultl = mysql_query($sqll, $link);

$rowl=mysql_fetch_array($resultl);

if ($rowl['llamado']==0){

	$cont++;

echo "<tr class=\"data\">";

echo "<td width=\"2%\" >";

echo $cont;

echo "</td>";


echo "<form method=\"post\" action=\"llama.php\">";

echo "<input type=\"hidden\" value=".$row['idsocio']." name=\"valor\" /><td width=\"6%\" >";

echo "Llama?</td> <td width=\"4%\" ><input type=\"submit\" class=\"buttonmi\" value=\"Si\" name=\"llama\" />";

echo "</form>";

echo "</td>";

echo "<td width=\"40%\" >";

echo  $row['Nombres']." ".$row['ApPaterno']." ".$row['ApMaterno'];

echo "</td>";
echo "<td width=\"40%\" >";

$sqlst= "Select idtiposocio FROM socio_tiposocio where idsocio=".$row['idsocio'];
$resultst = mysql_query($sqlst, $link);
while($rowst= mysql_fetch_array($resultst)){
$sql4= "Select TipoSocio FROM tiposocio where idTipoSocio=".$rowst['idtiposocio'];
$result4 = mysql_query($sql4, $link);
$row4= mysql_fetch_array($result4);
echo $row4['TipoSocio']."\n" ;}
echo "</td>";
echo "<td width=\"7%\">";

echo $row['Telefono'];

echo "</td>";

echo "<td width=\"7%\">";

echo $row['Celular']; 

echo "</td>";
echo "<td width=\"7%\">";

echo edad($row['FechaNacimiento'])." años"; 

echo "</td>";

$sqlm = "SELECT * FROM mensajeado WHERE idsocio=".$row['idsocio']. " and YEAR(fechahoy)=20".date("y");

$resultm = mysql_query($sqlm, $link);

$nrowm=mysql_num_rows($resultm);



$rowm=mysql_fetch_array($resultm);

	
if($row['Email']!=' '){
if ($rowm['mensajeado']==0){





echo "<form method=\"post\" action=\"mailphp.php\">";

echo "<input type=\"hidden\" value=".$row['idsocio']." name=\"valor\" />";

echo  "<td>Mail?</td><td><input type=\"submit\" class=\"buttonmi\" value=\"Si\">";

echo "</form>";

echo "</td>";}}

echo "</tr>";

}}



echo "</table>";

}}}?>



<?

}else

{

	echo "<SCRIPT LANGUAGE=\"javascript\">";

echo "location.href = \"index.php\"";

echo "</SCRIPT>";

	}

?>
